package com.yangrd.helper.crudhelper.core.crud.ctrl;


import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author yangrd
 * @date 2020/10/23
 */
public interface CrudCtrlService {

    /**
     * save
     * @param domainName
     * @param reqBody
     * @return
     */
    Object save(String domainName, String reqBody);

    /**
     * delete
     * @param domainName
     * @param ids
     */
    void delete(String domainName,  List<String> ids);

    /**
     * update
     * @param domainName
     * @param id
     * @param reqBody
     */
    void update(String domainName, String id, String reqBody);

    /**
     * findAll
     * @param domainName
     * @param request
     * @param pageable
     * @return
     */
    Page<Object> findAll(String domainName, HttpServletRequest request, Pageable pageable);


    /**
     * listAll
     * @param domainName
     * @param request
     * @param sort
     * @return
     */
    List<Object> listAll(String domainName, HttpServletRequest request, Sort sort);

    /**
     * get
     * @param domainName
     * @param id
     * @return
     */
    Object get(String domainName, String id);
}
